<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.min.js" integrity="sha384-IDwe1+LCz02ROU9k972gdyvl+AESN10+x7tBKgc9I5HFtuNz0wWnPclzo6p9vxnk" crossorigin="anonymous"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <style>
        body{
            background-image: url("${pageContext.request.contextPath}/img/icon.jfif");
            background-size: 100% 100%;
            background-attachment: fixed;
            background-repeat: no-repeat;
        }
        .register-form{
            padding: 20px;
            display: flex;
            flex-direction: column;
            width: 900px;
            margin: 160px auto;
            border: 1px solid white;
        }
        .register{
            margin: 6px;
        }
        .register input{
            background: #1bb6d9;
            border: none;
            width: 70px;
            height: 35px;
            float: right;
        }
        .register-form input[type="text"],input[type="password"]{
            height: 32px;
            font-size: 18px;
            font-weight: lighter;
        }
        .register-info{
            font-size: 12px;
        }
        .form-group.row{
            flex-wrap: nowrap;
        }
    </style>
</head>
<body>
<div class="main-panel container">
    <form action="${pageContext.request.contextPath}/active/register" method="post" class="register-form">
        <div class="form-group row">
            <label for="username" class="col-sm-3 col-form-label">用户名：</label>
            <div class="col-sm-5">
                <input type="text" id="username" name="username"
                       value="${want.username}"
                       class="form-control" placeholder="请输入用户名">
            </div>
            <div class="col-sm-4 text-danger">
                <form:errors path="want.username"/>
            </div>
        </div>
        <div class="form-group row">
            <label for="nickname" class="col-sm-3 col-form-label">昵称：</label>
            <div class="col-sm-5">
                <input type="text" id="nickname" name="nickname"
                       value="${want.nickname}"
                       class="form-control" placeholder="请输入昵称">
            </div>
            <div class="col-sm-4 text-danger">
                <form:errors path="want.nickname"/>
            </div>
        </div>
        <div class="form-group row">
            <label for="password" class="col-sm-3 col-form-label">密码：</label>
            <div class="col-sm-5">
                <input type="text" id="password" name="password"
                       value="${want.password}"
                       class="form-control" placeholder="请输入密码">
            </div>
            <div class="col-sm-4 text-danger">
                <form:errors path="want.password"/>
            </div>
        </div>
        <div class="form-group row">
            <label for="identityPassword" class="col-sm-3 col-form-label">确认密码：</label>
            <div class="col-sm-5">
                <input type="text" id="identityPassword" name="identityPassword"
                       value="${want.identityPassword}"
                       class="form-control" placeholder="请再一次输入密码">
            </div>
            <div class="col-sm-4 text-danger">
                <form:errors path="want.identityPassword"/>
            </div>
        </div>
        <div class="register">
            <input type="submit" value="注册">
        </div>
        <div class="register-info">
            <label>我已经有了账号|</label>
            <a href="${pageContext.request.contextPath}/login">登录</a>
        </div>
    </form>
</div>
<c:choose>
    <c:when test="${same!=null}">
        <div class="row text-bg-light">
            <div class="container">
                <div class="container text-danger">
                    <c:if test="${sameUsername!=null}">
                        该用户名已经被注册 ${sameUsername}
                    </c:if>
                </div>
                <div class="container text-danger">
                    <c:if test="${sameNickname!=null}">
                        该昵称已经被注册 ${sameNickname}
                    </c:if>
                </div>
                <div class="container text-danger">
                    <c:if test="${sameSchoolId!=null}">
                        该学号已经被使用${sameSchoolId}
                    </c:if>
                </div>
            </div>
        </div>
    </c:when>
</c:choose>
</body>
</html>